package com.onlinemart.view;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.onlinemart.model.*;
public class MasterData {
	Buisness buisnessObject = new Buisness();
	RequestDispatcher  requestDispature;
	public void checkLogin(HttpServletRequest request, HttpServletResponse  response)
	{
		try
		{
			System.out.println("In MasterData checkLogin");
			boolean validate;
			String email = request.getParameter("emailId");	
			String passwd = request.getParameter("password");
			validate=buisnessObject.validateUser(email,passwd);
			System.out.println("Validate = "+validate);
			if(validate==true)
			{
				requestDispature = request.getRequestDispatcher("User.jsp");
				requestDispature.forward(request, response);
			}
			else
			{
				requestDispature = request.getRequestDispatcher("home.jsp");
				requestDispature.forward(request, response);
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}
